﻿using ConfExpert.Forms.Base;
using ConfExpert.Utility;
using DevExpress.XtraEditors;
using DevTeam;
using System;
using System.Windows.Forms;

namespace ConfExpert.Forms.Du4
{
    public partial class MergeCards : XForm
    {
        public MergeCards()
        {
            InitializeComponent();
        }

        BindingSource bs;
        private void MergeCards_Load(object sender, EventArgs e)
        {
            
            bs = new BindingSource(ds, "xDU4Merge");
            InitGridView(gridView1, bs);
            gridView1.OptionsView.NewItemRowPosition = DevExpress.XtraGrid.Views.Grid.NewItemRowPosition.Bottom;
            btnMerge.ItemClick += btnMerge_ItemClick;
        }

        void btnMerge_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
          ExecuteNonQuery("KartBirlestirTOPLU", ds.xDU4Merge.Serialize());
            AppSession.MainForm.RefreshData();
            gridView1.RefreshData();
            XtraMessageBox.Show("SilinecekId alanı boşalan kartlar birleştirildi.");
        }
    }
}